package hwl;
/**
 * 
 * Created on: 2011-4-7
 * @author luxiaoyuan
 *
 */

import static org.junit.Assert.*;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;

public class GetRootBisectTest1 {
	private GetRootBisect RootBisect;
	private int n;
	private double xStart,xEnd,dblStep,eps;
	private double delta;
	private double[] x;

	@Before
	public void setUp() throws Exception {
		RootBisect=new GetRootBisect();
		delta=0.0;
	}

	@After
	public void tearDown() throws Exception {
	}

	@Test
	public void testGetRootBisect() {
		n=0;
		xStart=1.0;
		xEnd=2.0;
		dblStep=0.05;
		eps=0.01;
		x=new double[0];
		assertEquals(0,RootBisect.getRootBisect(n, x, xStart, xEnd, dblStep, eps),delta);
	}
	@Test
	public void testGetRootBisect1() {
		n=1;
		xStart=1.0;
		xEnd=0;
		dblStep=0.05;
		eps=0.01;
		x=new double[1];
		assertEquals(0,RootBisect.getRootBisect(n, x, xStart, xEnd, dblStep, eps),delta);
	}
	@Test
	public void testGetRootBisect2() {
		n=1;
		xStart=0;
		xEnd=-3;
		dblStep=0.05;
		eps=0.01;
		x=new double[1];
		assertEquals(0,RootBisect.getRootBisect(n, x, xStart, xEnd, dblStep, eps),delta);
	}
	@Test
	public void testGetRootBisect3() {
		n=1;
		xStart=-3;
		xEnd=2.0;
		dblStep=0.05;
		eps=0.01;
		x=new double[1];
		assertEquals(1,RootBisect.getRootBisect(n, x, xStart, xEnd, dblStep, eps),delta);
	}
	@Test
	public void testGetRootBisect4() {
		n=1;
		xStart=-4;
		xEnd=2.0;
		dblStep=10;
		eps=0.01;
		x=new double[1];
		assertEquals(0,RootBisect.getRootBisect(n, x, xStart, xEnd, dblStep, eps),delta);
	}
	@Test
	public void testGetRootBisect5() {
		n=1;
		xStart=1.0;
		xEnd=5;
		dblStep=0.05;
		eps=0.01;
		x=new double[1];
		assertEquals(1,RootBisect.getRootBisect(n, x, xStart, xEnd, dblStep, eps),delta);
	}
	@Test
	public void testGetRootBisect6() {
		n=2;
		xStart=1.0;
		xEnd=-3;
		dblStep=0.05;
		eps=0.01;
		x=new double[2];
		assertEquals(0,RootBisect.getRootBisect(n, x, xStart, xEnd, dblStep, eps),delta);
	}
	@Test
	public void testGetRootBisect7() {
		n=2;
		xStart=-4;
		xEnd=0;
		dblStep=0.05;
		eps=0.01;
		x=new double[2];
		assertEquals(1,RootBisect.getRootBisect(n, x, xStart, xEnd, dblStep, eps),delta);
	}
	@Test
	public void testGetRootBisect8() {
		n=2;
		xStart=0;
		xEnd=6;
		dblStep=0.05;
		eps=0.01;
		x=new double[2];
		assertEquals(1,RootBisect.getRootBisect(n, x, xStart, xEnd, dblStep, eps),delta);
	}
	@Test
	public void testGetRootBisect9() {
		n=2;
		xStart=0;
		xEnd=8;
		dblStep=10;
		eps=0.01;
		x=new double[2];
		assertEquals(1,RootBisect.getRootBisect(n, x, xStart, xEnd, dblStep, eps),delta);
	}
	@Test
	public void testGetRootBisect10() {
		n=2;
		xStart=-2;
		xEnd=6;
		dblStep=0.05;
		eps=0.01;
		x=new double[2];
		assertEquals(2,RootBisect.getRootBisect(n, x, xStart, xEnd, dblStep, eps),delta);
	}
	@Test
	public void testGetRootBisect11() {
		n=3;
		xStart=0;
		xEnd=3;
		dblStep=0.05;
		eps=0.01;
		x=new double[3];
		assertEquals(0,RootBisect.getRootBisect(n, x, xStart, xEnd, dblStep, eps),delta);
	}
	@Test
	public void testGetRootBisect12() {
		n=3;
		xStart=1.0;
		xEnd=6.0;
		dblStep=0.05;
		eps=0.01;
		x=new double[3];
		assertEquals(1,RootBisect.getRootBisect(n, x, xStart, xEnd, dblStep, eps),delta);
	}
	@Test
	public void testGetRootBisect13() {
		n=3;
		xStart=1.0;
		xEnd=8;
		dblStep=10;
		eps=0.01;
		x=new double[3];
		assertEquals(1,RootBisect.getRootBisect(n, x, xStart, xEnd, dblStep, eps),delta);
	}
	@Test
	public void testGetRootBisect14() {
		n=3;
		xStart=-6;
		xEnd=0;
		dblStep=10;
		eps=0.01;
		x=new double[3];
		assertEquals(1,RootBisect.getRootBisect(n, x, xStart, xEnd, dblStep, eps),delta);
	}
	@Test
	public void testGetRootBisect15() {
		n=3;
		xStart=-8;
		xEnd=-1;
		dblStep=0.05;
		eps=0.01;
		x=new double[3];
		assertEquals(1,RootBisect.getRootBisect(n, x, xStart, xEnd, dblStep, eps),delta);
	}

}
